﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HFBizSystemLib;

namespace HFBizPro
{
    public partial class xfMain : HFBizFormLib.xfBase
    {
        public xfMain()
        {
            InitializeComponent();
        }

        // mode 1 代表正常, 2 代表布满
        private void showInPanle(HFBizFormLib.xfBase xfb, int mode)
        {
            if (mode.Equals(1))
            {
                xfb.TopLevel = false;
                xfb.Visible = true;
                int x = int.Parse(((pcWorkSpace.Width - xfb.Width) / 2).ToString());
                int y = int.Parse(((pcWorkSpace.Height - xfb.Height) / 2).ToString());
                xfb.Location = new Point(x, y);
                pcWorkSpace.Controls.Add(xfb);
            }

            if (mode.Equals(2))
            {
                xfb.TopLevel = false;
                xfb.Visible = true;
                pcWorkSpace.Controls.Add(xfb);
                xfb.WindowState = FormWindowState.Maximized;
            }
        }

        private void nbiUsr_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            xfUsr fusr = new xfUsr();
            showInPanle(fusr,1);
        }

        private void nbiCompany_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            xfCompany fcompany = new xfCompany();
            showInPanle(fcompany,1);
        }

        private void nbWarehouse_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            xfWarehouse fwarehouse = new xfWarehouse();
            showInPanle(fwarehouse,1);
        }

        private void nbiEmployee_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            xfEmployee femployee = new xfEmployee();
            showInPanle(femployee,2);
        }
    }
}
